<template>
	<view>
		<!-- banner -->
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">法律解释</view>
			</view>
			<image :src="topimg" mode=""></image>
		</view>
		<!-- 搜索 -->
		<view class="ffffff mainpadding">
			<view class="sousuobox">
				<view class="flexbetween">
					<input type="text" placeholder="请输入输入关键词" @confirm="init()" v-model="keywords" confirm-type="search">
					<view class="flexright" @click="init">
						<view class="strongtext margin_right1">搜索</view>
						<u-icon name="search" color="#c89d3b" size="20"></u-icon>
					</view>
				</view>
			</view>
		</view>
		<!-- 内容 -->
		<view class="mainpadding">
			<view class="flexbetween xuxian xiabj margin_top2" v-for="item in list.data" :key="item.id" @click="tzfljs(item.id)">
				<view class="nostrongtext xiankuan123">{{item.title}}</view>
				<view class="nostrongtext">{{item.createtime_text}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid:"",
				topimg: "",
				keywords:"",
				page: 1,
				limit: 12,
				list: {
					data: [],
				},
			}
		},
		onLoad(options) {
			if(options.id){
				this.listid = options.id
			}
			if(options.keywords){
				this.keywords = options.keywords
			}
			this.init()
			this.getbanner()
		},
		methods: {
			getbanner() {
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 14,
					is_more: 2
				}, false, false, true).then(res => {
					this.topimg = res.data.image_text
				})
			},
			init(isPage, page) {
				let _this = this;
				httpRequest.request("/api/index/flfgIndex", 'GET', {
					page: page || 1,
					limit: _this.limit,
					keywords: this.keywords,
					flfg_type_id: this.listid
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							_this.list = resList
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转法律解释
			tzfljs(id){
				uni.navigateTo({
					url:'/pages/index/falvjieshixq?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.xiabj{
		padding-bottom: 10rpx;
	}
.fudongdw {
		position: absolute;
		bottom: 68rpx;
		left: 36%;
	}
	.xiankuan123{
		width: 450rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
</style>
